<!-- <?xml version="1.0" encoding="UTF-8"?> -->
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
   xmlns:f="http://xmlns.jcp.org/jsf/core"
   xmlns:h="http://xmlns.jcp.org/jsf/html"
   xmlns:p="http://primefaces.org/ui"
   xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
   template="/WEB-INF/templates/business/supplier/template.xhtml">
   
   	<ui:define name="metadata">
	   	<f:metadata>
	   		<f:viewParam name="self" value="#{serviceSupplierHome.self}"></f:viewParam>
	   	</f:metadata>
   	</ui:define>
	
	<ui:define name="supplier_head">
		<style type="text/css">
			.label{width:150px}
			.value{width:90%}
			h2{
   				text-align:center
   			}
   			.rowStyle{
	   			text-align: center;
	   			font-size:16px
   			}
		</style>
	
	</ui:define>
	
	<ui:define name="supplier_content">
		<h:form id="queryForm">
		
		    <p:tabView>
		        <p:tab title="基本信息">
		        	
		        	<p:panelGrid columns="2" cellpadding="5" style="width: 100%" columnClasses="label">
		        		<p:outputLabel value="信用分" />		
						<h:outputText value="#{serviceSupplierHome.instance.creditScore}" style="font-weight:bold;color:red;" />	
							
						<p:outputLabel value="公司名称" />		
						<h:outputText value="#{serviceSupplierHome.instance.cnname}" />		
												   
						<p:outputLabel value="单位性质或组织形式" />				
						<h:outputText id="companyType" 
									  value="#{serviceSupplierHome.instance.companyType}"/>
						
						<p:outputLabel value="统一社会信用代码" />
						<h:outputText id="creditCode" 
								   value="#{serviceSupplierHome.instance.creditCode}" />
						
						<p:outputLabel value="注册资金(万元)" />				
						<h:outputText id="registeredFund" 
								  value="#{serviceSupplierHome.instance.registeredFund}" />
						
						<p:outputLabel value="注册登记机关" />				
						<h:outputText id="registrationAuthority" 
								  value="#{serviceSupplierHome.instance.registrationAuthority}" />
						
						<p:outputLabel value="注册登记号" />				
						<h:outputText id="registrationNo" 
								  value="#{serviceSupplierHome.instance.registrationNo}" />
						
						<p:outputLabel value="成立时间" />		
						<h:outputText  id="regtime" 
									value="#{serviceSupplierHome.instance.regtime}">
							<f:convertDateTime pattern="yyyy-MM-dd"/>
						</h:outputText>
						
						<p:outputPanel>
							<p:outputLabel value="营业执照" />
						</p:outputPanel>
						<div id="imgsPreview" >
							<img  data-original="#{attachmentUtils.getFullPath(serviceSupplierHome.instance.businessLicenseImages[0])}" src="#{attachmentUtils.getFullPath(serviceSupplierHome.instance.businessLicenseImages[0])}"  id="img" width="240"/>
						</div>			
										
						
						<p:outputPanel rendered="#{serviceSupplierHome.instance.taxProveImages.size() > 0}">
							<p:outputLabel value="纳税证明" />
						</p:outputPanel>
						<p:outputPanel rendered="#{serviceSupplierHome.instance.taxProveImages.size() > 0}">
							<div id="imgsPreview2" >
								<p:repeat var="_taxImage" value="#{serviceSupplierHome.instance.taxProveImages}">
									<img  data-original="#{attachmentUtils.getFullPath(_taxImage)}" src="#{attachmentUtils.getFullPath(_taxImage)}"  id="img" width="240"/>								
								</p:repeat>
							</div>		
							
						</p:outputPanel>	
							
						<p:outputLabel value="办公地址" />				
						<h:outputText id="address" 
								  value="#{serviceSupplierHome.instance.address}" />
						
						<p:outputLabel value="法定代表人" />				
						<h:outputText id="legalPerson" 
								  value="#{serviceSupplierHome.instance.legalPerson}" />
						
						<p:outputLabel value="法定代表人联系电话" />				
						<h:outputText id="legalPersonPhoneNumber" 
								  value="#{serviceSupplierHome.instance.legalPersonPhoneNumber}" />
						
						<p:outputLabel value="第一联系人" />				
						<h:outputText id="firstContactor" 
								  value="#{serviceSupplierHome.instance.firstContactor}" />
						
						<p:outputLabel value="第一联系人电话" />				
						<h:outputText id="firstContactorPhoneNumber" 
								  value="#{serviceSupplierHome.instance.firstContactorPhoneNumber}" />
						
						<p:outputLabel value="第二联系人" />				
						<h:outputText id="secondContactor" 
								  value="#{serviceSupplierHome.instance.secondContactor}" />
						
						<p:outputLabel value="第二联系人电话" />				
						<h:outputText id="secondContactorPhoneNumber" 
								  value="#{serviceSupplierHome.instance.secondContactorPhoneNumber}" />
						
						<p:outputLabel value="员工数" />				
						<h:outputText id="employeeCount" 
								  value="#{serviceSupplierHome.instance.employeeCount}" />
						
						<p:outputLabel value="高级职称人数" />				
						<h:outputText id="highTitleEmployeeCount" 
								  value="#{serviceSupplierHome.instance.highTitleEmployeeCount}" />
						
						<p:outputLabel value="中级职称人数" />				
						<h:outputText id="mediumTitleEmployeeCount" 
								  value="#{serviceSupplierHome.instance.mediumTitleEmployeeCount}" />
						
						<p:outputLabel value="初级职称人数" />				
						<h:outputText id="beginnerTitleEmployeeCount" 
								  value="#{serviceSupplierHome.instance.beginnerTitleEmployeeCount}" />
							   
						<p:outputLabel value="是否政府服务供应商" />				
						<h:outputText id="govServiceSupplier" 
								   value="#{serviceSupplierHome.instance.govServiceSupplier ? '是' : '否'}" />
											   
						<p:outputLabel value="中介机构所在地区" />		
						<h:outputText id="region"
								   value="#{codeDicUtils.getCodeDicValueKeyMap('所在地区')[serviceSupplierHome.instance.region]}" />
						
						<p:outputLabel value="营业期限" />					
						<h:outputText id="businessAllotedTime"
								   value="#{serviceSupplierHome.instance.busnissAllotedTime}" 
								rendered="#{not serviceSupplierHome.instance.alwaysValid}">
							<f:convertDateTime pattern="yyyy-MM-dd"/>
						</h:outputText>
						<h:outputText value="长期有效"
								   rendered="#{serviceSupplierHome.instance.alwaysValid}" />
						
						<p:outputLabel for="intro" value="机构简介" />	
						<h:outputText id="intro"
								   value="#{serviceSupplierHome.instance.intro}" />
						
					</p:panelGrid>
		        	
		        </p:tab>
		        
		        <p:tab title="主营业务">
		        	<p:repeat var="_business" value="#{serviceSupplierHome.instance.mainBusinesses}" varStatus="_status">
		        		<p:panel header="主营业务#{_status.index + 1}">
		        			<p:panelGrid columns="2" columnClasses="label, value" style="width: 100%">
		        				<p:outputLabel value="资质大类" />	
								<h:outputText 
										   value="#{_business.agentService.name}" />
										   
								<p:outputLabel value="服务时限承诺" />	
								<h:outputText 
										   value="#{_business.commitOfTime}" />
										   
								<p:outputLabel value="服务收费承诺" />	
								<h:outputText 
										   value="#{_business.commitOfPrice}" />
										   
								<p:outputLabel value="服务质量承诺" />	
								<h:outputText 
										   value="#{_business.commitOfQuality}" />
		        			</p:panelGrid>
		        			
							<p:dataTable id="uploadedImages#{_business.bussinessIndex}" value="#{_business.images}" var="_attr" rowIndexVar="_row" emptyMessage="无已上传图片">
						
								<p:column headerText="文件名">
									<h:outputText value="#{_attr.filename}" />
								</p:column>
													
								<p:column headerText="大小（MB）" style="text-align: right;">
									<h:outputText value="#{_attr.filesize / 1024 / 1024}">	
										<f:convertNumber minFractionDigits="2" groupingUsed="true" />
									</h:outputText>
								</p:column>
								
								<p:column headerText="预览">
									<div id="imgsPreview_#{_attr.id}">
										<img data-original="#{attachmentUtils.getFullPath( _attr )}" src="#{attachmentUtils.getFullPath( _attr )}" width="240"/>
									</div>
								</p:column>
								
							</p:dataTable>

		        		</p:panel>
		        	</p:repeat>
		        </p:tab>
		        
		        <p:tab title="资质信息">
		        <p:repeat var="_cert" value="#{serviceSupplierHome.instance.certs}" varStatus="_status">
		        	<p:panel header="资质证书#{_status.index+1}">
	            			<p:dataTable  value="#{_cert.qualificationTemplates}" var="_template" >
	            				<p:column headerText="资质分类">
								<h:outputText value="#{_template.qualificationClass.name}" />
		            			</p:column>
		            			
		            			<p:column headerText="所属行业" colspan="3">
									<h:outputText value="#{_template.getSectorNames()}" />
		            			</p:column>
		            			
		            			<p:column headerText="证书等级">
									<h:outputText value="#{_template.qualificationLevel.name}" />
		            			</p:column>
		            			
		            			<p:column headerText="#{_template.qualificationClass.auditDepartment.cnname}审核结果">
									<h:outputText value="未审核" rendered="#{empty _cert.auditResult}" />
									<h:outputText value="通过" rendered="#{_cert.auditResult}" />
									<h:outputText value="驳回" rendered="#{not empty _cert.auditResult and not _cert.auditResult}" />
		            			</p:column>
	            			</p:dataTable>
	            			
	            			<p:panel header="驳回信息"  rendered="#{not empty _cert.auditResult and not _cert.auditResult}">
	            				<h:panelGrid columns="2" cellpadding="5">
	            					<p:outputLabel  value="驳回时间" />				
									<h:outputText value="#{_cert.auditTime}" rendered="#{not empty _cert.auditResult and not _cert.auditResult}">
										<f:convertDateTime pattern="yyyy-MM-dd"/>
									</h:outputText>
									<p:outputLabel  value="驳回原因" />				
									<h:outputText value="#{_cert.currRejectRecord.reason}" rendered="#{not empty _cert.auditResult and not _cert.auditResult}" />            					
		            			</h:panelGrid>	
	            			</p:panel>
						</p:panel>
		        
		       		 </p:repeat>
		            
		        </p:tab>
		    </p:tabView>
		    
		    <p:button value="修改基本信息" outcome="ServiceSupplierEdit.xhtml">
		    	<f:param name="serviceSupplierId" value="#{serviceSupplierHome.instance.id}"></f:param>
		    </p:button>
		     <p:button id="auditInfoEdit" value="修改待核的信息" outcome="ServiceSupplierLicenseEdit.xhtml">
		    	<f:param name="serviceSupplierId" value="#{serviceSupplierHome.instance.id}"></f:param>
		    </p:button>
		    <p:tooltip id="toolTipGrow1" for="auditInfoEdit" value="请谨慎修改,修改这些信息需要审核，在审核期间，会影响您的选取！"
      									showEffect="clip" hideEffect="explode" position="right"/>
		</h:form>
		
	</ui:define>
   
</ui:composition>